using System;
using FluentValidation.TestHelper;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace BookingSystem.Entities
{
    [TestClass]
    public class BookingValidatorTests
    {
        private BookingValidator _validator;
        [TestInitialize]
        public void TestInitialize()
        {
            _validator = new BookingValidator();
        }

        [TestMethod]
        public void StartDate_WithNoValue_Error()
        {
            _validator.ShouldHaveValidationErrorFor(x => x.StartDate, DateTime.MinValue);
        }

        [TestMethod]
        public void EndDate_WithNoValue_Error()
        {
            _validator.ShouldHaveValidationErrorFor(x => x.EndDate, DateTime.MinValue);
        }

        [TestMethod]
        public void EndDate_GreaterThenStartDate_Error()
        {
            _validator.ShouldHaveValidationErrorFor(x => x.EndDate, new Booking(){StartDate = DateTime.Today.AddDays(1),EndDate = DateTime.Today});
        }

        [TestMethod]
        public void StartDate_LesserThenEndDate_Error()
        {
            _validator.ShouldHaveValidationErrorFor(x => x.EndDate, new Booking() { StartDate = DateTime.Today.AddDays(1), EndDate = DateTime.Today });
        }


        [TestMethod]
        public void Guest_WithNoValue_Error()
        {
            _validator.ShouldHaveValidationErrorFor(x => x.Guest, new Booking());
        }

        [TestMethod]
        public void Resource_WithNoValue_Error()
        {
            _validator.ShouldHaveValidationErrorFor(x => x.Resource, new Booking());
        }
    }
}